using UnityEngine;

public class MarketMainButtons : MonoBehaviour
{
	public MarketEquipButton equipButton;

	public MarketBuyButton buyButton;

	public MarketVehicleUpgradeButton upgradeButton;

	public UIWidget widget;

	public UIGrid grid;

	private void OnClick()
	{
		Debug.Log(MarketControllerUI.instance.selectedProduct.id);
	}

	public void SetMainButtons()
	{
		buyButton.SetButton();
		equipButton.SetButton();
		upgradeButton.SetButton();
		SetButtonWidth();
		grid.repositionNow = true;
	}

	private void SetButtonWidth()
	{
		int num = 0;
		if (buyButton.gameObject.activeInHierarchy)
		{
			num++;
		}
		if (equipButton.gameObject.activeInHierarchy)
		{
			num++;
		}
		if (upgradeButton.gameObject.activeInHierarchy)
		{
			num++;
		}
		int width = 100;
		switch (num)
		{
		case 1:
			width = 340;
			break;
		case 2:
			width = 165;
			break;
		case 3:
			width = 105;
			break;
		}
		buyButton.buttonSprite.width = width;
		equipButton.buttonSprite.width = width;
		upgradeButton.buttonSprite.width = width;
		equipButton.buttonSprite.ResizeCollider();
		buyButton.buttonSprite.ResizeCollider();
		upgradeButton.buttonSprite.ResizeCollider();
	}
}
